import UsersApi from "../api/admins.js";
export const request = ({ type = "GET", url, data = {}, headers = {} }) =>
  new Promise(resolve => {
    $.ajax({
      type,
      url,
      data,
      headers,
      success: resolve,
    });
  });
export const ajaxInit = () => {
  $.ajaxSetup({
    beforSend(xhr) {
      const token = UsersApi.getToken();
      if (token) {
        xhr.setRequestHeader("authorization",`Bearer ${token}`)
      }
    },
  });
};

